package mx.com.daycare.business;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.ejb.Stateless;

import mx.com.daycare.entity.Family;
import mx.com.daycare.entity.Kid;
import mx.com.daycare.entity.Parent;

/**
 * Session Bean implementation class FamilyBL
 */
@Stateless
public class FamilyBL implements FamilyBLLocal {

	/**
	 * Default constructor.
	 */
	public FamilyBL() {
		// TODO Auto-generated constructor stub
	}

	public List<Family> getFamilies() {
		List<Family> families = new ArrayList<Family>();
		Parent ricardo = new Parent(1, "Ricardo Ascencio Chavez", "ricardo.ascencio@gmail.com", "33002211", "3310756310", "Empleado", "TATA");
		Parent karla = new Parent(2, "Karla Thatiana Cuevas Hengst", "karla.cuevas@gmail.com", "33220011", "3336766747", "Empleado", "Colegio Ingles Hidalgo");
		Parent ruben = new Parent(3, "Ruben Alejandro Araujo Gomez", "rubenudg@gmail.com", "33220011", "3311558844", "Empleado", "Colegio Ingles Hidalgo");
		Parent gaby = new Parent(4, "Gabriela Gomez Gomez", "lngabygomez@gmail.com", "33112200", "3352712035", "Empleado", "Antiguo Hospital Civil");
		Parent papu = new Parent(5, "Francisco Javier Gomez Gomez", "javier.gomez@gmail.com", "11330022", "3315803692", "Empleado", "Hospital San Pio");
		Parent gabyP = new Parent(6, "Gabriela Gonzalez Gonzalez", "gabriela.gonzalez@gmail.com", "33225000", "3310265040", "Empleado", "Hospital San Pio");
		Calendar matiasDate = Calendar.getInstance();
		matiasDate.set(Calendar.DAY_OF_MONTH, 12);
		matiasDate.set(Calendar.MONTH, Calendar.APRIL);
		matiasDate.set(Calendar.YEAR, 2011);
		Kid matias = new Kid(1, "Matias", "Masculino", 2, matiasDate.getTime(), "Guarderia Colegio Ingles Hidalgo", null, "AECM110412HJSSHC07", "Comunidad infantil", "", null);
		List<Kid> kidsAC = new ArrayList<Kid>();
		kidsAC.add(matias);
		Calendar alexDate = Calendar.getInstance();
		alexDate.set(Calendar.DAY_OF_MONTH, 12);
		alexDate.set(Calendar.MONTH, Calendar.NOVEMBER);
		alexDate.set(Calendar.YEAR, 2009);
		Kid alex = new Kid(2, "Alejandro", "Masculino", 4, alexDate.getTime(), "Guarderia Colegio Ingles Hidalgo", null, "OEGA091112HJSSHG03", "Comunidad infantil", "", null);
		Calendar sofiDate = Calendar.getInstance();
		sofiDate.set(Calendar.DAY_OF_MONTH, 12);
		sofiDate.set(Calendar.MONTH, Calendar.FEBRUARY);
		sofiDate.set(Calendar.YEAR, 2011);
		Kid sofi = new Kid(3, "Sofia", "Femenino", 2, sofiDate.getTime(), null, null, "OEGS110212MJSSHG07", "Comunidad infantil", "", null);
		List<Kid> kidsAG = new ArrayList<Kid>();
		kidsAG.add(alex);
		kidsAG.add(sofi);
		Calendar valeDate = Calendar.getInstance();
		valeDate.set(Calendar.DAY_OF_MONTH, 9);
		valeDate.set(Calendar.MONTH, Calendar.MARCH);
		valeDate.set(Calendar.YEAR, 2007);
		Kid vale = new Kid(4, "Valentina", "Femenino", 6, valeDate.getTime(), null, null, "OEGV070309MJSSHG09", "Primaria", "", null);
		Calendar jimenaDate = Calendar.getInstance();
		jimenaDate.set(Calendar.DAY_OF_MONTH, 25);
		jimenaDate.set(Calendar.MONTH, Calendar.JULY);
		jimenaDate.set(Calendar.YEAR, 2009);
		Kid jimena = new Kid(5, "Jimena", "Femenino", 4, jimenaDate.getTime(), null, null, "OEGJ090725MJSSHG05", "Kinder", "", null);
		List<Kid> kidsAV = new ArrayList<Kid>();
		kidsAV.add(vale);
		kidsAV.add(jimena);
		Family familyAC = new Family(1, "Ascencio", "Cuevas", ricardo, karla, kidsAC);
		Family familyAG = new Family(2, "Araujo", "Gomez", ruben, gaby, kidsAG);
		Family familyAV = new Family(3, "Gomez", "Gomez", papu, gabyP, kidsAV);
		families.add(familyAC);
		families.add(familyAG);
		families.add(familyAV);
		return families;
	}

	public Family getFamily(Integer id) {
		Parent ricardo = new Parent(1, "Ricardo Ascencio Chavez", "ricardo.ascencio@gmail.com", "33002211", "3310756310", "Empleado", "TATA");
		Parent karla = new Parent(2, "Karla Thatiana Cuevas Hengst", "karla.cuevas@gmail.com", "33220011", "3336766747", "Empleado", "Colegio Ingles Hidalgo");
		Parent ruben = new Parent(3, "Ruben Alejandro Araujo Gomez", "rubenudg@gmail.com", "33220011", "3311558844", "Empleado", "Colegio Ingles Hidalgo");
		Parent gaby = new Parent(4, "Gabriela Gomez Gomez", "lngabygomez@gmail.com", "33112200", "3352712035", "Empleado", "Antiguo Hospital Civil");
		Parent papu = new Parent(5, "Francisco Javier Gomez Gomez", "javier.gomez@gmail.com", "11330022", "3315803692", "Empleado", "Hospital San Pio");
		Parent gabyP = new Parent(6, "Gabriela Gonzalez Gonzalez", "gabriela.gonzalez@gmail.com", "33225000", "3310265040", "Empleado", "Hospital San Pio");
		Calendar matiasDate = Calendar.getInstance();
		matiasDate.set(Calendar.DAY_OF_MONTH, 12);
		matiasDate.set(Calendar.MONTH, Calendar.APRIL);
		matiasDate.set(Calendar.YEAR, 2011);
		Kid matias = new Kid(1, "Matias", "Masculino", 2, matiasDate.getTime(), "Guarderia Colegio Ingles Hidalgo", null, "AECM110412HJSSHC07", "Comunidad infantil", "", null);
		List<Kid> kidsAC = new ArrayList<Kid>();
		kidsAC.add(matias);
		Calendar alexDate = Calendar.getInstance();
		alexDate.set(Calendar.DAY_OF_MONTH, 12);
		alexDate.set(Calendar.MONTH, Calendar.NOVEMBER);
		alexDate.set(Calendar.YEAR, 2009);
		Kid alex = new Kid(2, "Alejandro", "Masculino", 4, alexDate.getTime(), "Guarderia Colegio Ingles Hidalgo", null, "OEGA091112HJSSHG03", "Comunidad infantil", "", null);
		Calendar sofiDate = Calendar.getInstance();
		sofiDate.set(Calendar.DAY_OF_MONTH, 12);
		sofiDate.set(Calendar.MONTH, Calendar.FEBRUARY);
		sofiDate.set(Calendar.YEAR, 2011);
		Kid sofi = new Kid(3, "Sofia", "Femenino", 2, sofiDate.getTime(), null, null, "OEGS110212MJSSHG07", "Comunidad infantil", "", null);
		List<Kid> kidsAG = new ArrayList<Kid>();
		kidsAG.add(alex);
		kidsAG.add(sofi);
		Calendar valeDate = Calendar.getInstance();
		valeDate.set(Calendar.DAY_OF_MONTH, 9);
		valeDate.set(Calendar.MONTH, Calendar.MARCH);
		valeDate.set(Calendar.YEAR, 2007);
		Kid vale = new Kid(4, "Valentina", "Femenino", 6, valeDate.getTime(), null, null, "OEGV070309MJSSHG09", "Primaria", "", null);
		Calendar jimenaDate = Calendar.getInstance();
		jimenaDate.set(Calendar.DAY_OF_MONTH, 25);
		jimenaDate.set(Calendar.MONTH, Calendar.JULY);
		jimenaDate.set(Calendar.YEAR, 2009);
		Kid jimena = new Kid(5, "Jimena", "Femenino", 4, jimenaDate.getTime(), null, null, "OEGJ090725MJSSHG05", "Kinder", "", null);
		List<Kid> kidsAV = new ArrayList<Kid>();
		kidsAV.add(vale);
		kidsAV.add(jimena);
		Family familyAC = new Family(1, "Ascencio", "Cuevas", ricardo, karla, kidsAC);
		Family familyAG = new Family(2, "Araujo", "Gomez", ruben, gaby, kidsAG);
		Family familyAV = new Family(3, "Gomez", "Gomez", papu, gabyP, kidsAV);
		Map<Integer, Family> families = new HashMap<Integer, Family>();
		families.put(familyAC.getId(), familyAC);
		families.put(familyAG.getId(), familyAG);
		families.put(familyAV.getId(), familyAV);
		System.out.println("FAMILY " + familyAC.getId());
		System.out.println("FAMILY MAP" + families.get(id));
		return families.get(id);
	}

}
